<?php

class LoginController extends Zendvn_Controller_Action
{
	protected $_arrParam;
    public function init()
    {
    	$this->_arrParam = $this->_request->getParams();
        /* Initialize action controller here */
       	$template_path = TEMPLATE_PATH . "/backend";
		$this->loadTemplate($template_path,'template.ini','template');
    }

    public function indexAction()
    {
        // action body
        
    }
	
	public function loginAction(){
		$this->view->Title = 'Login';
		$this->view->headTitle($this->view->Title,true);
		if($this->_request->isPost()){
			$auth =new Zendvn_System_Auth();
			if($auth->login($this->_arrParam)){
				$info = new Zendvn_System_Info();
				$info->createInfo();
				$this->_redirect('/backend/index');
			}
			else{
				$error[] =$auth->getError();
				$this->view->messageError = $error;
			}
		}
		
	}

}

